import {Injectable} from '@angular/core';
import {BehaviorSubject, Observable} from 'rxjs';
import {UserLogin} from '../types';

@Injectable({
  providedIn: 'root'
})
export class UserInfoService {
  private loginUserInfo$ = new BehaviorSubject<UserLogin>({ userName: '', userId: -1});

  constructor() {
  }

  // 获取主题参数
  setLoginUserInfoMode(mode: UserLogin): void {
    this.loginUserInfo$.next(mode);
  }

  getLoginUserInfoMode(): Observable<UserLogin> {
    return this.loginUserInfo$.asObservable();
  }
}
